<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>待发布游记</title>
	<#include "../common/header.ftl" >

	<script src="/static/jquery/jquery-form/jquery.form.js" ></script>
	<script src="/static/jquery/jquery-bootstrap/jquery.bootstrap.min.js"></script>

	<style>
		.modal-body img{
			width: 100%;
		}
	</style>


	<script>
		$(function () {
			//发布与拒绝
			$('.btn-state').click(function () {
                var id = $(this).data('id');
                var state = $(this).data('state');
                $.get('/travel/changeState.do',{id:id,state:state},function (data) {
                    if(data.success){
                        $.messager.alert('温馨提示','操作成功!  2s后刷新页面');
                        setTimeout(function () {
                            window.location.reload();
                        },2000);
                    }else{
                        $.messager.alert('温馨提示',data.msg);
					}
                })
            });
			
			//查看文章
			$('.btn-read').click(function () {
                var id = $(this).data('id');
                $.get('/travel/read.do',{id:id},function (data) {
					$('.content').html(data.content);
                });
				$('#travelModal').modal('show');
            })
        })
	</script>
</head>
<body>

<div class="container " style="margin-top: 20px">
	<#include "../common/top.ftl" >
	<div class="row">
		<div class="col-sm-3">
            <!--设置用于菜单回显-->
                <#assign currentMenu="audit_list">
			<#include "../common/menu.ftl" >
		</div>
		<div class="col-sm-9">
			<div class="row">
				<div class="col-sm-12">
					<h1 class="page-head-line">游记管理</h1>
				</div>
			</div>
            <!--高级查询--->
            <form class="form-inline" id="searchForm" action="/travel/audit_list.do" method="post">
                <div class="form-group">
                    <input id="currentPage" type="hidden" name="currentPage" value="${(qo.currentPage)!}">
                    <label for="keyword">关键字:</label>
                    <input type="text" class="form-control" id="keyword" name="keyword" value="${(qo.keyword)!}" placeholder="请输入标题/地点">
                </div>

                <select class="c-select form-control" name="state" id="state-query">
                    <option value="-2">全部</option>
                    <option value="1">待发布</option>
                    <option value="-1">拒绝</option>
                </select>
				<script>
					$('#state-query').val(${(qo.state)!})
				</script>

                <input type="submit" id="btn_query" class="btn btn-success" value="查询">

            </form>

			<table class="table table-striped table-hover" >
				<thead>
				<tr>
                    <th>标题</th>
                    <th>封面</th>
                    <th>地区</th>
                    <th>作者</th>
                    <th>状态</th>
				</tr>
				</thead>
				<#list  pageInfo.list as travel>
					<tr>
                        <td>${(travel.title)!}</td>
                        <td>
                            <img src='${(travel.coverUrl)!}' width="50px">
                        </td>
                        <td>${(travel.place.name)!}</td>
                        <td>${(travel.author.nickName)!}</td>
                        <td>${(travel.stateName)!}</td>
						<td>
							<button class="btn btn-info btn-xs btn-state" data-state='2'  data-id="${(travel.id)!}">
								发布
							</button>
							<button class="btn btn-info btn-xs btn-state" data-state='-1' data-id="${(travel.id)!}">
								拒绝
							</button>
							<button class="btn btn-info btn-xs btn-read" data-id='${(travel.id)!}'>
								查看文章
							</button>
                        </td>
					</tr>
				</#list>
			</table>

			<#include "../common/page.ftl" >
		</div>
	</div>
</div>

<div id="travelModal" class="modal" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">查看内容</h4>
            </div>
            <div class="modal-body content">
            </div>
            <div class="modal-footer">
                <a href="javascript:void(0);" class="btn btn-success" id="saveBtn" aria-hidden="true">保存</a>
                <a href="javascript:void(0);" class="btn" data-dismiss="modal" aria-hidden="true">关闭</a>
            </div>
        </div>
    </div>
</div>


</body>
</html>